﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using GetStocksPrototype.XigniteCurrencies;

namespace GetStocksPrototype
{
    class Program
    {
        static void Main(string[] args)
        {
            //http://finance.yahoo.com/webservice/v1/symbols/allcurrencies/quote
            string url = "http://www.batstrading.com/market_data/symbol_listing/xml/";

          /*  XDocument doc = XDocument.Load(url);

            var symbols = (from s in doc.Root.Element("symbols").Elements("symbol")
                          select new { Name = s.Attribute("name").Value }).ToList();

            string url1 = "http://www.google.com/ig/api?stock=APPL";
            /*for (int i = 0; i < 5; i++)
            {
                if (i == 0) url1 += string.Format("?stock={0}", symbols[i].Name);
                else
                    url1 += string.Format("&stock={0}", symbols[i].Name);
            }#1#

            
            XDocument doc1 = XDocument.Load(url1);
            var a = doc1;
            Console.WriteLine(doc1.ToString());*/
            var client = new XigniteCurrenciesSoapClient();
            var authHeader = new Header
                                 {
                                     Username = "zhelezko1990@gmail.com",
                                     Password = "Mypass0769"
                                 };
            var rates = client.GetHistoricalCrossRatesBidAsk(authHeader, "USDEUR,GBPAUD,GBPEUR", "10/01/2012");
            foreach (var rate in rates)
            {
                Console.WriteLine("###############################");
                Console.WriteLine(rate.Symbol);
                Console.WriteLine(rate.Text);
                Console.WriteLine(rate.High);
                Console.WriteLine(rate.Low);
                Console.WriteLine(rate.Bid);
                Console.WriteLine(rate.Ask);
                Console.WriteLine("###############################");
            }
        } 
    }
}
